//
//  AppDelegate.swift
//  ZMWB
//
//  Created by 朱敏 on 2017/9/14.
//  Copyright © 2017年 朱敏. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    /*
     打印Log的弊端
     1.非常消耗性能
     2.如果app部署到AppStore之后用户是看不到Log的
     
     所以
     开发阶段：显示Log
     部署阶段：隐藏Log
     
     */

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
//        print(#file) // 获取当前print所在的文件路径
//        print(#function) // 获取当前print所在的方法名称
//        print(#line) // 获取当前print所在的行号
        
        ZMLog(message: "abc")
        
        // 1.创建window
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.backgroundColor = UIColor.white
        window?.rootViewController = MainViewController()
        window?.makeKeyAndVisible()
        
        UINavigationBar.appearance().tintColor = UIColor.orange
        UITabBar.appearance().tintColor = UIColor.orange
        
        return true
    }

}

/*
 泛型
 如果想在函数中使用泛型，那么必须好俗系统这是一个泛型函数
 func 函数名称<T>(形参列表) -> 返回值类型
*/

//var flag: Bool = false

func ZMLog<T>(message: T, fileName: String = #file, methodName: String = #function, lineNumber: Int = #line){
    #if DEBUG
    print("\(methodName)[\(lineNumber)]:\(message)")
    #endif
}

